<?php
include("./path.ini");
include("./resource.inf");
include("./lib/cls/dbconnect.cls");
include("./lib/cls/logging.cls");
include("./treeview.inf");

$myLog = new ClsLog;

/*set a cookie if possible*/
$myLog->SetCke1();
if(strcmp($cat,"")) {
	$msg="cat=$cat";
}
elseif (strcmp($topic,"")) {
	$msg="tpc=$topic";
}

/*english is default*/
if($lang!='frn')
	$lang='eng';	

$msg.=",$lang";
?>
<html>
<head>

<title>Tropicalm Crowell Resource Demo</title>
<?php
include("$RESPATH/inc/header.inc");
include("$RESPATH/inc/tabcss.inc"); ?>

<script language='JavaScript'>
<!--
function check(crit) {

if (crit == '') {
	alert('You may not search for nothing...');
	return false;
}
return true;
}
//-->
</script>
</head>

<body bgcolor='white'>
<table border='0' cellspacing='0' cellpadding='0' width='500' class='small'>
  <tr><td><img src='inc/images/header.jpg' border='0' width='100%'></td></tr>
    <tr>
      <td>
  	<?php $tabndx=(int)$tabndx;
  	readfile("$RESURL/formattab.php3?cat=$cat&topic=$topic&lang=$lang&tabndx=$tabndx");?>
      </td>
    </tr>
  <tr><td><img src='inc/images/tabmat.gif' border='0' width='100%'></td></tr>
  <tr>
    <td><table border='0' cellspacing='0' cellpadding='0' width='100%'>
          <tr valign='top'><td align='left'><img src='inc/images/3l.gif' border='0' <?php
                	$filename="topics/$lang/".strtolower($topic).".inf";
			if($tabndx!=1 && file_exists($filename)) {
				include($filename);
			}
			else { $height=480;
			}
			print "height='$height'"; ?> width='10'></td>
            <td>
		<table border='0' cellspacing='0' cellpadding='0' width='100%'>
		  <tr><td align='center' valign='top' width='20%' class='small'>
			<?php include("$RESPATH/inc/optpanelleft.inc");
			echo "\t\t\t</td>\n";

			switch($tabndx) {
			case 0:
			/*Tab 0 -> Topics*/
			    echo "\t\t\t<td align='center' width='60%'>\n";
		    		echo "\t\t\t<!-- TreeView -->";
		    		readfile("$RESURL/search.php3?cat=$cat&topic=$topic&lang=$lang");
		    	break;
		    	
		    	case 1:
		    	    echo "\t\t\t<td align='left' width='60%' class='small'>\n";
		    	/*Tab 1 -> Search*/
		    		echo "\t\t\t\t<!-- Search Engine -->\n";
		    		readfile("$RESURL/searchtab.php3?cat=$cat&topic=$topic&lang=$lang");
		    	break;
			}
			print "\n";
		    	?>
		</table>
	    </td>	
	    <td align='right'><img border='0' src='inc/images/3r.gif' <?php
                	$filename="topics/$lang/".strtolower($topic).".inf";
			if($tabndx!=1 && file_exists($filename)) {
				include($filename);
			}
			else { $height=480;
			}
			print "height='$height'"; ?> width='11'></td>
	  </tr>
	</table>
    </td>
  </tr>
  <tr>
    <td><img border='0' src='inc/images/pagemat.gif' width='100%'></td>
  </tr>
  <tr>
    <!-- Advertising -->
    <td bgcolor='#FD8C00' width='100%' height='35' align='center' class='comment'>&nbsp;</td>
  </tr>
    <td align='middle'><img border='0' src='inc/images/6b.gif' width='100%'></td>
  </tr>
  <tr>
    <td align='middle'><?php include("/lib/inc/disclosure_res.inc");
    /*This include is the copyright of this project, but you may remove it of course!*/ ?></td>
  </tr>
</table>
<?php if($tabndx==1) {
	/*search tab, set focus to the criteria input text*/
	echo "<script language='JavaScript'><!--\n";
	echo "document.forms[0].crit.focus();\n";
	echo "--></script>";
}
$myLog->InsLg('RESDM',$msg); ?>
</body>
</html>
